<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <!-- 引用模板 Header -->
    <div th:insert="bg/publicHead :: publicHead"></div>
    <!-- [ Header ] end -->

    <style type="text/css">
        .inputStyle{ padding:0px !important; }
        i{ cursor:pointer; }
        .red{ color:#FF3535; font-weight:700; }
        .blue{color:#0000ff; font-weight:700;}
        .img{width:50px; height:50px;}
        .Export{ display:flex; justify-content:flex-start; align-items:center; }
        .Export div{ margin-right:10px; }
        .userimg{ border-radius:100%; width:50px; height:50px;}
        .addDoctors{ color:red !important; cursor: pointer; }
        a{cursor: pointer; }
    </style>
    <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/js/stroage.js" type="text/javascript" charset="UTF-8"></script>
    <script src="/js/comm.js" type="text/javascript" charset="UTF-8"></script>
    <script th:inline="javascript">
        window.onerror=function(){return true;};
        var reg=/^1((34[0-8]\d{7})|((3[0-3|5-9])|(4[5-7|9])|(5[0-3|5-9])|(66)|(7[2-3|5-8])|(8[0-9])|(9[1|8|9]))\d{8})$/
        var ServerIP=[(${ServerIP!=null?'"'+ServerIP+'"':'"'+'"'})];
        $(document).ready(function() {
            $(".funBtn").click(async function(){
                var dataid=$(this).attr("id");
                var that=$(this);
                var doctorAccount=$(this).parents(".trClass").find(".docaccount").val();
                var docPwd=$(this).parents(".trClass").find(".docpwd").val();
                var uname=$(this).parents(".trClass").find(".uname").val();
                var usex=$(this).parents(".trClass").find(".usex").val();
                var uage=$(this).parents(".trClass").find(".uage").val();
                var dochospital=$(this).parents(".trClass").find(".dochospital").val();
                var docgoodat=$(this).parents(".trClass").find(".docgoodat").val();
                var docphone=$(this).parents(".trClass").find(".docphone").val();
                var docscore=$(this).parents(".trClass").find(".docscore").val();
                console.log(doctorAccount+","+docPwd);
                if (confirm("是否更改?")) {
                    //alert(dataid+","+cardAccount+","+cardPwd);
                    updateData={
                        id:dataid,
                        docaccount:doctorAccount,
                        docpwd:docPwd,
                        uname:uname,
                        usex:usex,
                        dochospital:dochospital,
                        docgoodat:docgoodat,
                        docphone:docphone,
                        docscore:docscore
                    };
                    if(updateData!=null){
                        var res=await SyncJson("/api/updateDoctors",updateData);
                        if(res.code===200){
                            alert("更新成功");
                        }
                    }
                }
            });
            //添加医生
            $(".addDoctors").click(function(){
                window.open("/bg/adddoctor");
            });
            //删除按钮
            $(".delBtn").click(async function(){
                var dataid=$(this).attr("id");
                if (confirm("是否删除医生?")) {
                    alert("医生id"+dataid);
                    deleteData={
                        id:dataid
                    };
                    if(deleteData!=null){
                        var res=await SyncJson("/api/deleteUDoctor",deleteData);
                        if(res.code===200){
                            alert("删除成功");
                        }
                    }
                }
            });
        });
    </script>
</head>


<body class="background-img-7">

<!-- [ navigation menu ] start -->
<!-- 引用模板 Header -->
<div th:insert="bg/templateLeft :: Menu(${pageName})"></div>
<!-- [ navigation menu ] end -->


<!-- [ Header ] start -->
<!-- 引用模板 Header -->
<div th:insert="bg/templateTop :: Header"></div>
<!-- [ Header ] end -->


<!-- [ Main Content ] start -->
<div class="pcoded-main-container"> <!--中间 Start -->

    <div class="pcoded-content">

        <!-- [ homePage ] start -->
        <!-- 引用模板 homePage -->
        <div th:insert="bg/homePage :: homePage"></div>
        <!-- [ homePage ] end -->


        <!-- [ Main Content ] start -->
        <!-- [ 内容区域 ] start -->
        <div class="row">
            <!-- 课程列表 -->

            <div class="col-xl-12 mainCotent">
                <h5><text th:text="${pageName}"></text></h5>
                <div><a href="/bg/doctors">刷新</a> / <a class="addDoctors">添加医生账号</a></div>
                <!-- json源码 -->
                <!-- Latest Order start -->
                <div class="col-md-12">
                    <div class="card table-card latest-activity-card" style="margin-top:20px;">

                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-hover table-borderless">
                                    <!-- dt-responsive table-responsive -->
                                    <!--<table id="res-config" class="display table table-striped table-hover dt-responsive nowrap" style="width:100%">-->
                                    <thead>
                                    <tr>
                                        <th width="130px"><div align="center">id</div></th>
                                        <th width="130px"><div align="center">头像</div></th>
                                        <th width="120px"><div align="center">医生账号</div></th>
                                        <th width="120px"><div align="center">登录密码</div></th>
                                        <th width="130px"><div align="center">医生名称</div></th>
                                        <th width="60px"><div align="center">性别</div></th>
                                        <th width="200px"><div align="center">年龄</div></th>
                                        <th width="100px"><div align="center">职位</div></th>
                                        <th width="100px"><div align="center">任职医院</div></th>
                                        <th width="80px"><div align="center">擅长</div></th>
                                        <th width="60px"><div align="center">手机号码</div></th>
                                        <th width="60px"><div align="center">评分</div></th>
                                        <th width="60px"><div align="center">医生患者</div></th>
                                        <th width="80px"><div align="center">操作</div></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <!--<div th:text="${doctorsData}"></div>-->
                                    <tr class="trClass" th:if="${doctorsData!=null}"  th:each="item:${doctorsData}">
                                        <td style="width:50px;"><div align="center" th:text="${item.id}"></div></td>
                                        <td style="width:130px;"><div align="center"><img class="userimg" th:src="${item.headimg}"></div></td>
                                        <td style="width:120px;"><div align="center"><input type="text" class="docaccount" style="width:100px" th:value="${item.docaccount}"></div></td>
                                        <td style="width:120px;"><div align="center"><input type="text" class="docpwd" style="width:100px" th:value="${item.docpwd}"></div></td>
                                        <td style="width:130px;"><div align="center"><input type="text" class="uname" style="width:100px" th:value="${item.uname}"></div></td>
                                        <td style="width:130px;"><div align="center"><input type="text" class="usex" style="width:100px" th:value="${item.usex}"></div></td>
                                        <td style="width:60px;"><div align="center"><input type="text" class="uage" style="width:100px" th:value="${item.uage}"></div></td>
                                        <td style="width:200px;"><div align="center" th:text="${item.docjob}"></div></td>
                                        <td style="width:100px;"><div align="center"><input type="text" class="dochospital" style="width:100px" th:value="${item.dochospital}"></div></td>
                                        <td style="width:100px;"><div align="center"><input type="text" class="docgoodat" style="width:100px" th:value="${item.docgoodat}"></div></td>
                                        <td style="width:80px;"><div align="center"><input type="text" class="docphone" style="width:100px" th:value="${item.docphone}"></div></td>
                                        <td style="width:60px;"><div align="center"><input type="text" class="docscore" style="width:100px" th:value="${item.docscore}"></div></td>
                                        <td style="width:200px;"><div align="center"><a style="color:blue;" th:href="'/bg/doctoruser-'+${item.id}" target="_blank" th:text="${item.myUserNumber}"></a></div></td>
                                        <td style="width:80px;">
                                            <div align="center">
                                                <a th:id="${item.id}" title="发货" class="funBtn"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a>
                                                <a th:id="${item.id}" title="删除" class="delBtn"><i class="icon feather icon-delete f-w-600 f-16 m-r-15 text-c-green"></i></a>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Latest Order end -->
            </div>
        </div> <!-- [ Main Content ] end -->

    </div>

</div> <!--中间 End -->


<!-- 引用模板 Bottom -->
<div th:insert="bg/publicBottom :: publicBottom"></div>
<!-- [ Bottom ] end -->



<script src="/js/sweetalert.min.js"></script>
<script th:inline="javascript">
    var ServerIP= [[${ServerIP}]];
    $(document).ready(function() {

    });
</script>

</body>



</html>